#include<bits/stdc++.h>
using namespace std;

class Solution
{
private:
    /* data */
public:
    int minCostClimbingStairs(vector<int>& cost){
        int n=cost.size();
        if(n<3){
            return min(cost[0],cost[1]);
        }
        int temp;
        cost.emplace_back(0);
        vector<int> dp(cost.size()+1);
        dp[0]=0;
        dp[1]=0;
        for(int i=2;i<cost.size();++i){
            dp[i] = min(dp[i-1]+cost[i-1],dp[i-2]+cost[i-2]);
        }
        return dp[cost.size()-1];
    }
};

int main(int argc, char const *argv[])
{
    Solution s;
    // vector<int> cost = {1, 100, 1, 1, 1, 100, 1, 1, 100, 1};
    vector<int> cost = {10, 15, 20};
    int res = s.minCostClimbingStairs(cost);
    cout<<res<<endl;

    return 0;
}


